<?php
	class Connect{
		private static $_instance;
		private $_pointer;
		
		private function __construct(){
			$this->_pointer = mysql_connect('localhost','root','123');
			mysql_select_db('dti',$this->_pointer);
		}
		public function __destruct(){
			mysql_close($this->_pointer);
		}
		public static function getInstance(){
			if(self::$_instance === null){
				self::$_instance = new self();
			}
			return self::$_instance;
		}
		public function query($sql){
			return mysql_query($sql,$this->_pointer);
		}
		public function fetch($res){
			return mysql_fetch_assoc($res);
		}
	}
?>